<!--
 * @Descripttion: 酒店审核
 * @version: 
 * @Author: zhangjie
 * @Date: 2021-04-28 14:36:26
 * @LastEditors: wang pingqi
 * @LastEditTime: 2022-05-05 17:09:41
-->
<template>
  <KiFormDialog
    v-if="hotelName"
    :show.sync="row.show"
    v-model="row.data"
    class="dialog-channel"
    title="酒店审核"
    width="30%"
    :submit="submit"
    :loading="row.loading"
    :before-close="()=>{ $emit('clearHotelId') }"
  >
    <template #el-form>
    <el-alert
      class="mb40"
      :title="hotelName"
      type="warning"
      :closable="false"
      center />
      <el-form-item label="是否通过审核?" prop="status" verify>
        <el-radio-group v-model="row.data.status">
          <el-radio label="1">同意</el-radio>
          <el-radio label="0">不同意</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item v-if="row.data.status === '0' " label=" " prop="description" :verify="{ minLength: 2 , maxLength: 100 }">
        <el-input type="textarea" v-model="row.data.description" placeholder="请输入内容" maxlength="100" show-word-limit></el-input>
      </el-form-item>
    </template>
  </KiFormDialog>

</template>

<script>
export default {
  name: 'Channel',
  props: {
  },
  watch: {
    '$attrs.id': {
      handler: function(newID) {
        if (newID) {
          this.hotelId = newID
          this.row.loading = false
          this.row.show = true
          this.queryForDetail()
        }
      },
      immediate: true
    },
  },
  data () {
    return {
      hotelId: null,
      row: {
        show: false,
        loading: false,
        status: 'c',
        data: {},
      },
      hotelName: ''
    }
  },
  computed: {
  },
  methods: {
    submit() {
      return this.$POST('sot-admin-api/hotel/self-employed/review', { 'hotelId': this.hotelId, ...this.row.data }).then(_ => {
        this.$swal.success(_.message)
        this.$emit('refresh')
      })
    },
    queryForDetail() {
      this.$POST('sot-admin-api/hotel/self-employed/queryForDetail', { 'id': this.hotelId }).then(_ => {
        this.hotelName = _.data?.hotelName
      })
    }
  }
}
</script>

<style lang="scss" scoped>
:deep(.dialog-channel) {
  .el-alert__title{
    font-size: 15px;
  }
}
</style>
